import logging,yagmail,pytest,HTMLTestRunner_cn

def log():
    logging.basicConfig(filename='126.log',filemode='a+',level=logging.DEBUG,format='%(levelname)s %(filename)s %(asctime)s %(message)s %(lineno)d')

def baogao():
    baogao1=HTMLTestRunner_cn.HTMLTestRunner(open('./126.html','w'),title='126测试报告',description='baogao')
    return baogao1

def emailll():
    ema=yagmail.SMTP(user='2314336117@qq.com',password='ixpbgkkezjwodhif',host='smtp.qq.com',port=465)
    ema.send(to='2314336117@qq.com',subject='126邮件',contents=['126.log','126.html'])

if __name__ == '__main__':
    log()
    pytest.main([r"C:\Users\23143\PycharmProjects\pythonProject911\yuekaomoni2\TestCase.py","-s","--html=126.html"])
    emailll()